#if !defined(__DATA_JSON_HPP__)
#    define __DATA_JSON_HPP__

#    pragma once
#    include <boost/json.hpp>
#    include <iostream>

template <class T>
void extract(boost::json::object const& obj, T& t, boost::json::string_view key) {
    try {
        t = boost::json::value_to<T>(obj.at(key));
    }
    catch (const std::exception& e) {
        std::cerr << e.what() << '\n';
    }
}

using JsonValue = boost::json::value;
std::string toString(JsonValue value);

#endif  // __DATA_JSON_HPP__
